From 78da78d77b345652fba9738e6366aab15ce417c3 Mon Sep 17 00:00:00 2001 From: tsteven4 <13596209+tsteven4@users.noreply.github.com> Date: Wed, 27 May 2020 14:31:23 -0600 Subject: [PATCH] clang tidy modernize-use-auto on gui. --- gui/filterdlg.cc | 4 ++-- gui/gmapdlg.cc | 2 +- gui/gpx.h | 4 ++-- gui/mainwindow.cc | 4 ++-- gui/map.cc | 4 ++-- gui/optionsdlg.cc | 28 ++++++++++++++-------------- gui/preferences.cc | 2 +- gui/processwait.cc | 2 +- 8 files changed, 25 insertions(+), 25 deletions(-) diff --git a/gui/filterdlg.cc b/gui/filterdlg.cc index 4cec01772..7ac89c0ab 100644 --- a/gui/filterdlg.cc +++ b/gui/filterdlg.cc @@ -34,7 +34,7 @@ FilterDialog::FilterDialog(QWidget* parent, AllFiltersData& fd): QDialog(parent) ui_.filterList->clear(); widgetStack_ = new QStackedWidget(ui_.frame); - QHBoxLayout* layout = new QHBoxLayout(ui_.frame); + auto* layout = new QHBoxLayout(ui_.frame); layout->addWidget(widgetStack_); layout->setContentsMargins(2, 2, 2, 2); @@ -74,7 +74,7 @@ FilterDialog::FilterDialog(QWidget* parent, AllFiltersData& fd): QDialog(parent) //------------------------------------------------------------------------ void FilterDialog::addFilterPage(const QString& name, FilterWidget* fw, bool* use) { - QListWidgetItem* it = new QListWidgetItem(name); + auto* it = new QListWidgetItem(name); it->setCheckState(*use? Qt::Checked:Qt::Unchecked); fw->setEnabled(*use); ui_.filterList->addItem(it); diff --git a/gui/gmapdlg.cc b/gui/gmapdlg.cc index e03149c56..ea44ad1e2 100644 --- a/gui/gmapdlg.cc +++ b/gui/gmapdlg.cc @@ -145,7 +145,7 @@ GMapDialog::GMapDialog(QWidget* parent, const QString& gpxFileName, QPlainTextEd gpx_.read(gpxFileName); mapWidget_ = new Map(this, gpx_, te); - QHBoxLayout* lay = new QHBoxLayout(ui_.frame); + auto* lay = new QHBoxLayout(ui_.frame); lay->setContentsMargins(0, 0, 0, 0); lay->addWidget(mapWidget_); diff --git a/gui/gpx.h b/gui/gpx.h index 85b682384..cb01396fb 100644 --- a/gui/gpx.h +++ b/gui/gpx.h @@ -126,7 +126,7 @@ public: prevPt = thisPt; } } - double* dptr = (double*)(&cachedLength); // big cheat + auto* dptr = (double*)(&cachedLength); // big cheat *dptr = dist; return cachedLength; } @@ -352,7 +352,7 @@ public: } } } - double* dptr = (double*)(&cachedLength); // big cheat + auto* dptr = (double*)(&cachedLength); // big cheat *dptr = dist; return cachedLength; } diff --git a/gui/mainwindow.cc b/gui/mainwindow.cc index adbac733d..3e88c8a3c 100644 --- a/gui/mainwindow.cc +++ b/gui/mainwindow.cc @@ -888,10 +888,10 @@ bool MainWindow::isOkToGo() bool MainWindow::runGpsbabel(const QStringList& args, QString& errorString, QString& outputString) { - QProcess* proc = new QProcess(nullptr); + auto* proc = new QProcess(nullptr); QString name = "gpsbabel"; proc->start(QApplication::applicationDirPath() + '/' + name, args); - ProcessWaitDialog* waitDlg = new ProcessWaitDialog(nullptr, proc); + auto* waitDlg = new ProcessWaitDialog(nullptr, proc); if (proc->state() == QProcess::NotRunning) { errorString = QString(tr("Process \"%1\" did not start")).arg(name); diff --git a/gui/map.cc b/gui/map.cc index 9efeb6e09..5f366d335 100644 --- a/gui/map.cc +++ b/gui/map.cc @@ -81,8 +81,8 @@ Map::Map(QWidget* parent, this->logTime("Start map constructor"); #if HAVE_WEBENGINE - MarkerClicker* mclicker = new MarkerClicker(this); - QWebChannel* channel = new QWebChannel(this->page()); + auto* mclicker = new MarkerClicker(this); + auto* channel = new QWebChannel(this->page()); this->page()->setWebChannel(channel); // Note: A current limitation is that objects must be registered before any client is initialized. channel->registerObject(QStringLiteral("mclicker"), mclicker); diff --git a/gui/optionsdlg.cc b/gui/optionsdlg.cc index 43094fd63..56bafb026 100644 --- a/gui/optionsdlg.cc +++ b/gui/optionsdlg.cc @@ -93,23 +93,23 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetText(options_[k].getDescription()); horizontalLayout->addWidget(checkBox); checkBox->setChecked(options_[k].getSelected()); //checkBox->setWhatsThis(options[k].getHtml()); - QSpacerItem* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); + auto* horizontalSpacer = new QSpacerItem(0, 20, QSizePolicy::Expanding, QSizePolicy::Minimum); horizontalLayout->addItem(horizontalSpacer); QWidget* w = nullptr; switch (options_[k].getType()) { case FormatOption::OPTstring: { - QLineEdit* lineEdit = new QLineEdit(this); + auto* lineEdit = new QLineEdit(this); SetSizeStuff(lineEdit); lineEdit->setText(getOptionValue(options_, k).toString()); w = lineEdit; @@ -120,8 +120,8 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetText(getOptionValue(options_, k).toString()); button->setIcon(QIcon(inFile ? ":/images/open.png" : ":/images/save.png")); w = lineEdit; @@ -139,14 +139,14 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetText(getOptionValue(options_, k).toString()); w = lineEdit; double minVal = options_[k].getMinValue().toDouble(); double maxVal = options_[k].getMaxValue().toDouble(); if (minVal < maxVal) { - QDoubleValidator* v = new QDoubleValidator(this); + auto* v = new QDoubleValidator(this); v->setRange(minVal, maxVal); lineEdit->setValidator(v); } @@ -155,13 +155,13 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetRange(minVal, maxVal); lineEdit->setValidator(iv); } @@ -171,7 +171,7 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListsetRange(options_[k].getMinValue().toInt(), options_[k].getMaxValue().toInt()); spinBox->setValue(getOptionValue(options_, k).toInt()); @@ -197,11 +197,11 @@ OptionsDlg::OptionsDlg(QWidget* parent, const QString& fmtName, QListaddLayout(horizontalLayout); } - QPushButton* helpButton = new QPushButton(this); + auto* helpButton = new QPushButton(this); helpButton->setIcon(QIcon(":/images/help.png")); helpButton->setText(tr("Help")); - QHBoxLayout* lay = new QHBoxLayout(); + auto* lay = new QHBoxLayout(); lay->addWidget(helpButton); buttonBox_ = new QDialogButtonBox(this); diff --git a/gui/preferences.cc b/gui/preferences.cc index f648324bd..fbed65695 100644 --- a/gui/preferences.cc +++ b/gui/preferences.cc @@ -56,7 +56,7 @@ Preferences::Preferences(QWidget* parent, QList& formatList, connect(ui_.disableAllButton, SIGNAL(clicked()), this, SLOT(disableAllClicked())); for (int i = 0; i < formatList_.size(); i++) { - FormatListEntry* item = new FormatListEntry(formatList[i]); + auto* item = new FormatListEntry(formatList[i]); ui_.enabledFormatsList->addItem(item); } diff --git a/gui/processwait.cc b/gui/processwait.cc index 93bb4d206..33a4ef849 100644 --- a/gui/processwait.cc +++ b/gui/processwait.cc @@ -65,7 +65,7 @@ ProcessWaitDialog::ProcessWaitDialog(QWidget* parent, QProcess* process): { this->resize(400, 220); this->setWindowTitle(QString(appName) + tr(" ... Process GPSBabel")); - QVBoxLayout* layout = new QVBoxLayout(this); + auto* layout = new QVBoxLayout(this); textEdit_ = new QPlainTextEdit(this); textEdit_->setReadOnly(true); -- 2.30.2